package com.shiminghui.test;

public class TiaoZhengString {
    public static void main(String[] args) {
        
        String s = "abcdefg";
        String s1 = "abcdefg";

        System.out.println(check(s,s1));
    }

    public static String rotate(String s){
        String s1 = "";

        for (int i = 1; i < s.length(); i++) {
            s1 =s1+s.charAt(i);
            if (i==s.length()-1){
                s1 = s1+s.charAt(0);
            }
        }
        return s1;
    }

    public static String rotate1(String s){
        String s1 = "";
        s1=s.substring(1)+s.substring(0,1) ;
        return s1;
    }

    public static String rotate2(String s){
        char[] arr = s.toCharArray();
        for (int i = 0; i < arr.length-1; i++) {
            char c = arr[i];
            arr[i]=arr[i+1];
            arr[i+1] = c;
        }


        return new String(arr);
    }

    public static  boolean check(String strA,String strB){
        for (int i = 0; i < strA.length(); i++) {
            strA=rotate2(strA);
            if (strA.equals(strB)){
                return true;
            }
        }
        return false;
    }

}


